#ifndef SCREENTESTTHREAD_H
#define SCREENTESTTHREAD_H

#include <QThread>
#include <QTcpSocket>
#include <QSqlDatabase>
#include <QSqlQueryModel>
#include "def.h"
class ScreenTest
{
public:
    QString before_value;
    QString after_value;
    QString theaterNo;
};

class ScreenTestSetup{
public:
    QString before_ip;
    QString after_ip;
    QString theaterNo;
};

class ScreenTestThread : public QThread
{
    Q_OBJECT
public:
    explicit ScreenTestThread(QObject *parent = 0, QSqlDatabase *db = NULL);
    void run();
    QString read_data(char *s, QTcpSocket &socket);
//    bool connect(QTcpSocket &tcpSocket);
    bool connect(QTcpSocket &socket, QString ip, int port);
    void Stop(bool flag);
signals:
    void send_msg(QString msg);
    void log_info(QString msg);
public slots:
private:
    QTcpSocket  tcpSocket;
    QSqlDatabase db;
    QSqlQueryModel *model;
    QString sql;
    QList<ScreenTestSetup> device_list;
    QList<ScreenTest> result_list;
    volatile bool stopped;

};

#endif // SCREENTESTTHREAD_H
